<div class="container main">
  <div class="row">
    <div class="col-lg-7 col-md-7" id="category-list">
      <% @categories.each do |category| %>
          <% if @category.new_record? || category.id != @category.id %>
              <%= render 'category_list_li', category: category %>
          <% end%>
      <% end %>
    </div>
    <div class="col-lg-5 col-md-5">
      <div class="block-flat">
        <div class="header">
          <%= content_tag 'h3', @category.new_record? ? '创建类目' : '更新类目' %>
        </div>
        <div class="content">
          <%= form_for [:backend, @category], html: {role: 'form', autocomplete: 'off'}, remote: true do |f| %>
              <div class="form-group">
                <%= f.label :name %>
                <%= f.text_field :name, class: 'form-control', placeholder: :name %>
              </div>
              <%= f.submit 'Submit', class: 'btn btn-primary' %>
              <% unless @category.new_record? %>
                <%= link_to '创建新类目', backend_categories_path, class: 'btn btn-default' %>
              <% end %>
          <% end %>
        </div>
      </div>
    </div>
  </div>
</div>